package com.tmt.im.common.pojo;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.tmt.im.common.annotation._AllowUpdate;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.SuperBuilder;
import org.apache.ignite.cache.query.annotations.QuerySqlField;

import java.io.Serial;

/**
 * 用户缓存对象
 *
 * @Description TODO
 * @Author wuyi
 * @Date 2024/8/10 15:50
 * @Version 1.0
 **/
@Getter
@Setter
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class IMUserPoJo implements IGetKey<Long> {
    @Serial
    private static final long serialVersionUID = -2401821791828584307L;
    public static final String CACHE_NAME = "im_user";

    @QuerySqlField(name = "id", index = true)
    private Long id;

    @QuerySqlField(name = "username")
    private String username;

    @QuerySqlField(name = "nickname")
    @_AllowUpdate
    private String nickname;

    @QuerySqlField(name = "member_code")
    @_AllowUpdate
    private String memberCode;

    @QuerySqlField(name = "cert_no")
    private String certNo;

    @QuerySqlField(name = "cert_name")
    private String certName;

    @QuerySqlField(name = "avatar")
    @_AllowUpdate
    private String avatar;

    @QuerySqlField(name = "mobile")
    @_AllowUpdate
    private String mobile;

    @QuerySqlField(name = "sex")
    @_AllowUpdate
    private String sex;

    @QuerySqlField(name = "grade")
    @_AllowUpdate
    private Integer grade;

    @QuerySqlField(name = "setting_id")
    private Long settingId;

    @QuerySqlField(name = "wallet_id")
    private Long walletId;

    @JsonIgnore
    private boolean insert;

    @Override
    public Long getKey() {
        return id;
    }
}
